﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

public partial class InventoryTracker_GridV : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Populate1();
        Populate2();
    }

    public void Populate1()
    {
        SqlCommand cmd = new SqlCommand("SELECT * FROM [tblOne]", new SqlConnection(ConfigurationManager.AppSettings["ConnString"]));
        cmd.Connection.Open();

        SqlDataReader ddlValues;
        ddlValues = cmd.ExecuteReader();

        DropDownList1.DataSource = ddlValues;
        DropDownList1.DataValueField = "theName";
        DropDownList1.DataTextField = "theName";
        DropDownList1.DataBind();

        cmd.Connection.Close();
        cmd.Connection.Dispose();
    }

    public void Populate2()
    {
        SqlCommand cmd = new SqlCommand("SELECT * FROM [tblOne]", new SqlConnection(ConfigurationManager.AppSettings["ConnString"]));
        cmd.Connection.Open();

        SqlDataReader ddlValues;
        ddlValues = cmd.ExecuteReader();

        DropDownList2.DataSource = ddlValues;
        DropDownList2.DataValueField = "theCity";
        DropDownList2.DataTextField = "theCity";
        DropDownList2.DataBind();

        cmd.Connection.Close();
        cmd.Connection.Dispose();
    }
}